package br.ufrj.dcc.smarthotel.controls;

import java.lang.reflect.Type;
import java.util.List;

import br.ufrj.dcc.smarthotel.activities.RequestedServicesActivity;
import br.ufrj.dcc.smarthotel.entities.Request;

import com.google.gson.reflect.TypeToken;

public class RequestedServicesControl extends Control {
	private RequestedServicesActivity activity;
	
	public RequestedServicesControl (RequestedServicesActivity activity) {
		this.activity = activity;
	}

	@SuppressWarnings("unchecked")
	public void LoadRequests() {
		Type listType = new TypeToken<List<Request>>() {}.getType();
		List<Request> requestsList = (List<Request>) this.retrieve(this.baseURI + "employee/" + LoggedUserSession.getInstance().getSession().getUser().getEmployeeId() + "/request", listType);
		
		this.activity.setRequestsList(requestsList);
	}
}
